/*
 * @lc app=leetcode.cn id=459 lang=javascript
 *
 * [459] 重复的子字符串
 */

// @lc code=start
/**
 * @param {string} s
 * @return {boolean}
 */
var repeatedSubstringPattern = function(s) {
    let flag = false
    for (let index1 = 1; index1 < s.length; index1++) {
        if (s[0] === s[index1]) {
            if (s.length % index1 !== 0) {
                continue
            }
            // 以此index为标志，后续每一个是否都按照此顺序
            for (let index2 = 0; index2 < s.length - index1; index2++) {
                if (s[index1 + index2] === s[index2]) {
                    flag = true
                } else {
                    flag = false
                    break
                }
            }
            if (flag) {
                break
            }
        }
    }
    return flag
};
// @lc code=end

